package com.example.dota2draftsimulator.adapters;

import com.example.dota2draftsimulator.R;

import android.app.Activity;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class CustomSpinnerAdapter extends ArrayAdapter<String> {
	
	private Typeface type;
	private Activity context;
	String[] list;
	
	public CustomSpinnerAdapter(Activity context, int resource, String[] list) {
		super(context, resource, list);
		// TODO Auto-generated constructor stub
		type = Typeface.createFromAsset(context.getAssets(),"OPTIMUSPRINCEPSSEMIBOLD.TTF"); 
		this.context = context;
		this.list = list;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		return getCustomView(position, convertView, parent);
	}
	
	@Override
	public View getDropDownView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		return getCustomView(position, convertView, parent);
	}
	
	public View getCustomView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = context.getLayoutInflater();
        View mySpinner = inflater.inflate(R.layout.custom_spinner_style, parent, true);
        TextView main_text = (TextView) mySpinner.findViewById(R.id.custom_spinner_style_text_view);
        main_text.setText(list[position]);
        return mySpinner;
    }
	
}
